package com.huang.utils;


import com.huang.domain.ChinaTotal;
import net.sf.json.JSONObject;

public class ChinaTotalUtil {
    public static ChinaTotal getChinaTotal() {//国内总数据
        String json = TencentJsonUtil.getJson();
        JSONObject jsonObject = JSONObject.fromObject(json);

        //System.out.println("jsonObject = " + jsonObject);
        JSONObject string1 = JSONObject.fromObject(jsonObject.getString("data"));
        //System.out.println("string1 = " + string1);
        JSONObject chinaTotal = JSONObject.fromObject(string1.getString("chinaTotal"));
        //System.out.println("chinaTotal = " + chinaTotal);//国内总数据

        String confirm = chinaTotal.getString("confirm");
        String heal = chinaTotal.getString("heal");
        String dead = chinaTotal.getString("dead");
        String nowConfirm = chinaTotal.getString("nowConfirm");
        String suspect = chinaTotal.getString("suspect");
        String nowSevere = chinaTotal.getString("nowSevere");
        String importedCase = chinaTotal.getString("importedCase");
        String noInfect = chinaTotal.getString("noInfect");

        ChinaTotal ct = new ChinaTotal();//封装数据
        ct.setId(1);
        ct.setConfirm(confirm);
        ct.setHeal(heal);
        ct.setDead(dead);
        ct.setNowconfirm(nowConfirm);
        ct.setSuspect(suspect);
        ct.setNowsevere(nowSevere);
        ct.setImportedcase(importedCase);
        ct.setNoinfect(noInfect);

        //System.out.println("ct = " + ct);
        return ct;
    }
}
